/*********************************************************************
	Name: adc.h         
	Description: Convert data from two ADC channels
                 Channel_1 = AN1
                 Channel_2 = AN6
			
	Author: Chris Chester
	Date: 19/09/2012
	
	Notes: Adapted from code done by Andrew Nicholas
*********************************************************************/
#ifndef ADC_H_
#define ADC_H_

#include "type.h"

/* 	Initalizes the ADC
	Inputs: None
	Outputs: None  		*/
void adc_init();

/* 	Reads the first channel data from the buffer
	Inputs: None
	Outputs: First Channel Buffer data  		*/
uint16_t adc_read_ch1();

/* 	Reads the second channel data from the buffer
	Inputs: None
	Outputs: Second Channel Buffer data  		*/
uint16_t adc_read_ch2();

/* 	Checks to see if the ADC process is active
	Inputs: None
	Outputs: The active status (1 or 0)  		*/
uint16_t adc_busy();

/*  Stops any ADC conversion happening
	Inputs: None
	Outputs: None 		*/
void adc_close();

/*  Checks to see if an interupt has occured
	Inputs: None
	Outputs: The data received if any, or a zero 		*/
uint8_t adc_is_new_data();


/*	Sets the data received as the input value
	Inputs: Data to be set as the ADC value
	Outputs: The data received if any, or a zero 		*/
void adc_set_data_received(uint8_t);


#endif  /*ADC_H_*/
